package com.king.designpatterns.hybriddesignpattern.hybriddesignpattern.specificationpattern;

/**
 * 年龄大于指定年龄的规格书
 * @author king
 * @date 2021-06-16 16:33
 */
public class UserByAgeThan extends CompositeSpecification{
    /**
     * 基准年龄
     */
    private int age;

    public UserByAgeThan(int age) {
        this.age = age;
    }

    /**
     * 实现校验方法
     */
    @Override
    public boolean isSatisfiedBy(User user) {
        return user.getAge() > age;
    }
}
